import Api from "../../request/api"

export default {
    namespaced: true,
    state: {
        bannerlist: [],
        bannertotal: 0
    },
    mutations: {
        initbannerList(state, payload) {
            state.bannerlist = payload
        },
        initbannerTotal(state, payload) {
            state.bannertotal = payload
        }
    },
    actions: {
        getbannerlist({
            commit
        }, payload) {
            Api.bannerlist(payload).then(res => {
                if (res.code == 200) {
                    commit("initbannerList", res.list)
                }
            })
        },
        getbannercount({
            commit
        }) {
            Api.bannercount().then(res => {
                if (res.code == 200) {
                    console.log(res, 111);
                    commit("initbannerTotal", res.list[0].total)
                }
            })
        }

    }
}